/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.tordroid.ui;

import android.app.DialogFragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;
import de.tordroid.R;
import de.tordroid.core.Database;

/**
 *
 * @author Christian Simon
 */
public class SettingsDialogFragment extends DialogFragment {

    static SettingsDialogFragment newInstance() {
        return new SettingsDialogFragment();
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.settings_dialog, container, false);
        Button btn = (Button) v.findViewById(R.id.settings_btn_db_erase);
        btn.setOnClickListener(new View.OnClickListener() {

            public void onClick(View v) {
                Database.removeDatabase();
                Toast.makeText(getActivity(), "Database successfully removed", Toast.LENGTH_SHORT).show();
            }
        });
        return v;
    }
}
